<?php 
	//$this->load->view("tamu/form_stok.php");
	//$this->load->view("stok_peternakan/data_stok.php");
	//$this->load->view("peternakan/list_peternakan.php");
?>

<div class="row-fluid sortable ui-sortable">
	<div id="chart-permintaan" class="box span12">
		<div class="box-header well" data-original-title>
			<h2 id="action-title">Titik Pasok</h2>
			<div class="box-icon">
				<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
			</div>
		</div>
		<div class="box-content">
			<table class="table span5">
				<tr>
					<td>
						<label>Pilih Titik Pasok</label>
					</td>
					<td>
						<div class="controls">
							<select id="id-provinsi" data-rel="chosen" name='provinsi' onchange="drawGmaps(document.getElementById('id-provinsi').value);">
								<option value="0" selected>Semua Titik Pasok</option>
								<option value="1">Peternakan</option>
								<option value="2">RPH</option>
								<option value="3">Titik Penjualan</option>
								<option value="4">Agen</option>
							<?php
								/*foreach($provinsi as $key=>$data){
									echo "
										<option value='".$key."'>".$data."</option>
									";
								}*/
							?>
							</select>
						</div>
					</td>
				</tr>
			</table>
			<div id="ch-TP" style="height:400px"class=" box row-fluid sortable ui-sortable">
			</div>
		</div>
	</div>
</div>
<?php
	$titik_pasok = array();
	foreach($peternakan->result_array() as $data){
		$titik_pasok[] = array(
			"JENIS"		=> "1",
			"ID_TITIK"	=> $data["ID_TITIK_PASOK"],
			"NAMA"		=> $data["NAMA"],
			"ALAMAT"	=> $data["ALAMAT"],
			"TELP"		=> $data["NO_TELP"],
			"EMAIL"		=> $data["EMAIL"],
			"KODE_POS"	=> $data["KODE_POS"],
			"LAT"		=> $data["LAT"],
			"LON"		=> $data["LON"]
		);
	}
	foreach($rph->result_array() as $data){
		$titik_pasok[] = array(
			"JENIS"		=> "2",
			"ID_TITIK"	=> $data["ID_TITIK_PASOK"],
			"NAMA"		=> $data["NAMA"],
			"ALAMAT"	=> $data["ALAMAT"],
			"TELP"		=> $data["NO_TELP"],
			"EMAIL"		=> $data["EMAIL"],
			"KODE_POS"	=> $data["KODE_POS"],
			"LAT"		=> $data["LAT"],
			"LON"		=> $data["LON"]
		);
	}
	foreach($titik_penjualan->result_array() as $data){
		$titik_pasok[] = array(
			"JENIS"		=> "3",
			"ID_TITIK"	=> $data["ID_TITIK_PASOK"],
			"NAMA"		=> $data["NAMA"],
			"ALAMAT"	=> $data["ALAMAT"],
			"TELP"		=> $data["NO_TELP"],
			"EMAIL"		=> $data["EMAIL"],
			"KODE_POS"	=> $data["KODE_POS"],
			"LAT"		=> $data["LAT"],
			"LON"		=> $data["LON"]
		);
	}
	foreach($agen_sapi->result_array() as $data){
		$titik_pasok[] = array(
			"JENIS"		=> "4",
			"ID_TITIK"	=> $data["ID_TITIK_PASOK"],
			"NAMA"		=> $data["NAMA"],
			"ALAMAT"	=> $data["ALAMAT"],
			"TELP"		=> $data["NO_TELP"],
			"EMAIL"		=> $data["EMAIL"],
			"KODE_POS"	=> $data["KODE_POS"],
			"LAT"		=> $data["LAT"],
			"LON"		=> $data["LON"]
		);
	}
?>

